load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("fbcode_entropy_wardens_folly")

cpp_library(
    name = "bootstrap",
    exported_deps = [
        ":accept_routing_handler",  # @manual
        ":base_client_bootstrap",  # @manual
        ":client_bootstrap",  # @manual
        ":routing_data_handler",  # @manual
        ":server_bootstrap",  # @manual
        ":server_socket_factory",  # @manual
    ],
)

# Main Rules

cpp_library(
    name = "accept_routing_handler",
    headers = [
        "AcceptRoutingHandler.h",
        "AcceptRoutingHandler-inl.h",
    ],
    exported_deps = [
        ":routing_data_handler",
        ":server_bootstrap",
        "//wangle/channel:pipeline",
    ],
)

cpp_library(
    name = "base_client_bootstrap",
    headers = ["BaseClientBootstrap.h"],
    exported_deps = [
        "//folly:network_address",
        "//folly/futures:core",
        "//folly/io:socket_option_map",
        "//folly/io/async:async_socket",
        "//folly/io/async:async_ssl_socket",
        "//folly/ssl:ssl_session",
        "//wangle/channel:pipeline",
    ],
)

cpp_library(
    name = "client_bootstrap",
    headers = ["ClientBootstrap.h"],
    exported_deps = [
        ":base_client_bootstrap",
        "//folly/executors:io_thread_pool_executor",
        "//folly/io/async:async_socket",
        "//folly/io/async:async_ssl_socket",
        "//folly/io/async:destructor_check",
        "//folly/io/async:event_base_manager",
        "//wangle/channel:pipeline",
    ],
)

cpp_library(
    name = "routing_data_handler",
    headers = [
        "RoutingDataHandler.h",
        "RoutingDataHandler-inl.h",
    ],
    exported_deps = [
        "//wangle/channel:async_socket_handler",
    ],
)

cpp_library(
    name = "server_bootstrap",
    srcs = ["ServerBootstrap.cpp"],
    headers = [
        "ServerBootstrap.h",
        "ServerBootstrap-inl.h",
    ],
    deps = [
        "//folly/executors/thread_factory:named_thread_factory",
    ],
    exported_deps = [
        ":server_socket_factory",
        "//folly:exception_wrapper",
        "//folly:shared_mutex",
        "//folly/executors:io_thread_pool_executor",
        "//folly/io/async:async_transport",
        "//folly/io/async:delayed_destruction",
        "//folly/io/async:event_base_manager",
        "//folly/synchronization:baton",
        "//wangle/acceptor:acceptor",
        "//wangle/acceptor:managed",
        "//wangle/acceptor:shared_ssl_context_manager",
        "//wangle/channel:handler",
        "//wangle/channel:pipeline",
        "//wangle/ssl:ssl_stats",
    ],
)

cpp_library(
    name = "server_socket_factory",
    headers = ["ServerSocketFactory.h"],
    exported_deps = [
        "//folly/io/async:async_udp_server_socket",
        "//folly/io/async:event_base_manager",
        "//folly/io/async:server_socket",
        "//wangle/acceptor:acceptor",
    ],
)
